package IO;

import java.io.*;
/*
3)对象序列化：将一个Java对象转换为一组字节的过程称为对象序列化
 */

public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name = "张三丰";
        int age = 25;
        String gender = " 男";
        String[] otherInfo = {"实习生","练习了两年半","喜欢唱跳","篮球"};
        Student su = new Student(name,age,gender,otherInfo);
        System.out.println(su);
/*
对象输出流在序列化对象时，必须保证序列化对象实现Serializable接口
 */

        FileOutputStream fos = new FileOutputStream("student.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(su);
        System.out.println(" exit");
        oos.close();
    }
}
